package com.physique.tea.Mapper;

import com.physique.tea.Pojo.TcmSampleData;
import com.physique.tea.vo.TcmPredictDataVO;
import com.physique.tea.vo.TcmSampleDataVO;
import com.physique.tea.vo.TcmTeaVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface TcmSampleDataMapper {
    @Select("SELECT local, COUNT(*) AS count\n" +
            "FROM TCM_SAMPLE_DATA\n" +
            "GROUP BY local\n" +
            "ORDER BY count DESC;")
    List<TcmSampleDataVO> getTcmSampleDataLOCAL();

    @Select("SELECT local, COUNT(*) AS count\n" +
            "FROM TCM_SAMPLE_DATA where body=#{body}\n" +
            "GROUP BY local\n" +
            "ORDER BY count DESC")
    List<TcmSampleDataVO> getTcmSampleDataBODY(String body);


    @Select("SELECT body, COUNT(*) AS count\n" +
            "FROM TCM_SAMPLE_DATA\n" +
            "GROUP BY body\n" +
            "ORDER BY count DESC;")
    List<String> getTcmSampleDataLOCALList();

    @Select("select SEX,LOCAL,AGE,HEIGHT,WEIGHT,BMI,PREDICTED_BODY " +
            "from TCM_PREDICT;")
    @Result(property = "predictBody",column = "PREDICTED_BODY")
    List<TcmPredictDataVO> getAllPredictData();

    @Select("select PHYSIQUE,TEA,MATERIALS,EFFECT,SEASON,NOTE,PROPERTIES " +
            "from PHYSIQUE_TEA;")
    List<TcmTeaVO> getAllTeaData();

}
